package cn.xiaohuodui.service;

import cn.xiaohuodui.dao.CartMapper;
import cn.xiaohuodui.model.Cart;
import cn.xiaohuodui.res.JsonRes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by TR on 2018/4/4.
 */
@Service
public class CartService {

    @Autowired
    CartMapper cartMapper;

    public JsonRes<Map<String,Object>> goodscount(Integer userId){

        List<Cart> cartList = cartMapper.getByUid(userId);
        Map<String, Object> data = new HashMap();
        data.put("goodscount", cartList.size());
        return JsonRes.createBySuccessData(data);
    }


}
